<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <div id="app"></div>
  <script>
  setTimeout(() => {
    console.log('test');
  }, 0);
  // 消息通道
  let channel = new MessageChannel();
  let port1 = channel.port1;
  let port2 = channel.port2;

  port1.postMessage('你好');
  console.log(1);
  // vue 早期的nextTick 就是使用的次方法实现的
  port2.onmessage = function(e) {
    console.log('e', e.data);
  }
  console.log(2);
  </script>
</body>
</html>